package com.reading.controller;

import com.reading.pojo.ShellRecord;
import com.reading.service.ShellRecordService;
import com.reading.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("shellRecord")
public class ShellRecordController {

    @Autowired
    private ShellRecordService shellRecordService;

    @RequestMapping("/save")
    public R save(@RequestBody ShellRecord shellRecord){
        return   shellRecordService.save(shellRecord);
    }

    @RequestMapping("/findAll")
    public List<ShellRecord> findAll(Integer userId){
        return shellRecordService.findAll(userId);
    }

    @RequestMapping("/saveReceiveEmail")
    public void saveReceiveEmail(Integer id){
        shellRecordService.saveReceiveEmail(id);
    }

    @RequestMapping("/findOneEmail")
    public ShellRecord findOneEmail(Integer id){
        return shellRecordService.findOneEmail(id);
    }

    @RequestMapping("/saveReceivePhone")
    public void saveReceivePhone(Integer id){
        shellRecordService.saveReceivePhone(id);
    }

    @RequestMapping("/findOnePhone")
    public ShellRecord findOnePhone(Integer id){
        return shellRecordService.findOnePhone(id);
    }
}
